<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>利用函数翻转数组</title>
</head>
<body>
    <script>
        // 利用函数封装一个数组，翻转任意一个数组  reverse 翻转的意思
        function reverse(arr){
            var newArr = [];
            for (var i = arr.length; i >= 0; i--){
                newArr[newArr.length] = arr[i];

            }
            return newArr;

        }
        var arr1 = reverse([1,4,6,7,9]);
        console.log(arr1);
    </script>
</body>
</html>